<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<link href="resources/css/custom.css" rel="stylesheet" />
<script src="resources/js/jquery-1.10.2.js"></script>
<script src="resources/js/jquery-ui-1.10.4.custom.js"></script>
<style type="text/css">
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}

.STYLE1 {
	font-size: 12px
}

.STYLE3 {
	font-size: 12px;
	font-weight: bold;
}

.STYLE4 {
	color: #03515d;
	font-size: 12px;
}
</style>
<script>
var  highlightcolor='#c1ebff';
//此处clickcolor只能用win系统颜色代码才能成功,如果用#xxxxxx的代码就不行,还没搞清楚为什么:(
var  clickcolor='#51b2f6';
function  changeto(){
source=event.srcElement;
if  (source.tagName=="TR"||source.tagName=="TABLE")
return;
while(source.tagName!="TD")
source=source.parentElement;
source=source.parentElement;
cs  =  source.children;
//alert(cs.length);
if  (cs[1].style.backgroundColor!=highlightcolor&&source.id!="nc"&&cs[1].style.backgroundColor!=clickcolor)
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor=highlightcolor;
}
}

function  changeback(){
if  (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="nc")
return
if  (event.toElement!=source&&cs[1].style.backgroundColor!=clickcolor)
//source.style.backgroundColor=originalcolor
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor="";
}
}

function  clickto(){
source=event.srcElement;
if  (source.tagName=="TR"||source.tagName=="TABLE")
return;
while(source.tagName!="TD")
source=source.parentElement;
source=source.parentElement;
cs  =  source.children;
//alert(cs.length);
if  (cs[1].style.backgroundColor!=clickcolor&&source.id!="nc")
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor=clickcolor;
}
else
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor="";
}
}
$(document).ready(function(){
	
	//第一页和最后一页不可点击事件
	if(${pageInfo.pageNum<2||pageInfo.pageNum==null}){
		$("#href1").removeAttr('href');
		$("#href2").removeAttr('href');
	}
	if(${pageInfo.pageNum >= pageInfo.totalPages}){
		$("#href3").removeAttr('href');
		$("#href4").removeAttr('href');
	}
	//分页提交表单：id相同会有冲突
	$("#sub").click(function() {
		var pageNum = $("input[name='pageNum']").val();
		var name = $("#sub").attr("name");
		var url = "queryByType?pageNum="+pageNum+name;
		window.location.href=url;
	});
	
	$("#datepicker").datepicker({
		inline : true
	});
	$("#datepicker1").datepicker({
		inline : true
	});
	/*--全选 +全不选--*/
	$("#checkAll").click(function() {
		var dd = document.getElementsByTagName("input");
		for(i=0;i <dd.length;i++) { 
			if(dd[i].type=='checkbox' && dd[i].name == "checkbox"){ 
				dd[i].checked = this.checked;
			} 
		}
	});
	/*---------------------单个删除---------------------*/ 
	$("[href='#del']").click(function() {
		if(confirm("确定要删除该项吗？"))
		{	
			var id = $(this).attr("name");
			var thisItem = $(this).parents("#delMark");
			$.ajax({ 
	            type: "POST", 
	            url: "deleteItem", 
	            data: {"multiId":id},
	            success: function(result) { 
	            	thisItem.remove();
	            } 
	        }); 
		}
	});
	/*---------------------批量删除---------------------*/ 
    $("[href='#deletemore']").click(function() { 
        // 判断是否至少选择一项 
        var checkedNum = $("input[name='checkbox']:checked").length;
        if(checkedNum == 0) { 
            alert("请选择至少一项！"); 
            return; 
        } 
        // 批量选择  
        if(confirm("确定要删除所选项目？")) { 
            var checkedList = new Array(); 
            $("input[name='checkbox']:checked").each(function() { 
                checkedList.push($(this).val()); 
            }); 
			$.ajax({ 
                type: "POST", 
                url: "deleteItem", 
                data: {"multiId":checkedList.toString()},
                success: function(result) { 
                    $("[name ='checkbox']:checkbox").attr("checked", false);
                    window.location.reload();
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    alert("出错了");
                },
            });
        }            
    }); 
});
</script>
</head>
<body>
	<div style="float:left;background-color: #e4ecfc;width:100%;">
		<ul >
		<li style="margin-bottom:3px;margin-left:300px;float:left;"><a target="center-table" href="queryByType?pageNum=1&dateType=${dateType}&dateNum=${dateNum-1}">上一${dateType }</a></li>
		<li style="margin-left:100px;float:left;">${dateRange }</li>
		<li style="margin-left:100px; float:left;"><a target="center-table" href="queryByType?pageNum=1&dateType=${dateType}&dateNum=${dateNum+1}">下一${dateType }</a></li>
		</ul>
	</div><br/>
	<div style="float:left;width:100%;">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td height="30" background="resources/images/tab/tab_05.gif">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td width="12" height="30"><img
							src="resources/images/tab/tab_03.gif" width="12" height="30" /></td>
						<td>
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td width="46%" valign="middle"><table width="100%"
											border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td width="5%"><div align="center">
														<img src="resources/images/tab/tb.gif" width="16"
															height="16" />
													</div></td>
												<td width="95%" class="STYLE1"><span class="STYLE3">你当前的位置</span>：[查询统计]-[${dateType}汇总统计]</td>
											</tr>
										</table></td>
									<td width="54%">
										<table border="0" align="right" cellpadding="0"
											cellspacing="0">
											<tr>
												<td width="60">
													<table width="87%" border="0" cellpadding="0"
														cellspacing="0">
														<tr>
															<td class="STYLE1"><div align="center">
																	<input type="checkbox" name="checkbox62"
																		value="checkbox" id="checkAll" />
																</div></td>
															<td class="STYLE1"><div align="center">全选</div></td>
														</tr>
													</table>
												</td>
												<td width="60">
													<table width="90%" border="0" cellpadding="0"
														cellspacing="0">
														<tr>
															<td class="STYLE1"><div align="center">
																<img src="resources/images/tab/22.gif" width="14"
																	height="14" />
															</div></td>
															<td class="STYLE1"><div align="center">
																<a href="addItem" target="center-table">新增</a>
															</div></td>
														</tr>
													</table>
												</td>
												<td width="60">
													<table width="90%" border="0" cellpadding="0"
														cellspacing="0">
														<tr>
															<td class="STYLE1"><div align="center">
																	<img src="resources/images/tab/33.gif" width="14"
																		height="14" />
																</div></td>
															<td class="STYLE1"><div align="center">修改</div></td>
														</tr>
													</table>
												</td>
												<td width="52"><table width="88%" border="0"
														cellpadding="0" cellspacing="0">
														<tr>
															<td class="STYLE1"><div align="center">
																	<img src="resources/images/tab/11.gif" width="14"
																		height="14" />
																</div></td>
															<td class="STYLE1"><div align="center">
															<a href="#deletemore">删除</a>
															</div></td>
														</tr>
													</table></td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</td>
						<td width="16"><img src="resources/images/tab/tab_07.gif"
							width="16" height="30" /></td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td><table width="100%" border="0" cellspacing="0"
					cellpadding="0">
					<tr>
						<td width="8" background="resources/images/tab/tab_12.gif">&nbsp;</td>
						<td><table width="100%" border="0" cellpadding="0"
								cellspacing="1" bgcolor="b5d6e6" onmouseover="changeto()"
								onmouseout="changeback()">
								<tr>
									<td width="3%" height="22"
										background="resources/images/tab/bg.gif" bgcolor="#FFFFFF"><div
											align="center">&nbsp;</div></td>
									<td height="22" background="resources/images/tab/bg.gif"
										bgcolor="#FFFFFF"><div align="center">
											<span class="STYLE1">序号</span>
										</div></td>
									<td height="22" background="resources/images/tab/bg.gif"
										bgcolor="#FFFFFF"><div align="center">
											<span class="STYLE1">发生时间</span>
										</div></td>
									<td height="22" background="resources/images/tab/bg.gif"
										bgcolor="#FFFFFF"><div align="center">
											<span class="STYLE1">收支类型</span>
										</div></td>
									<td height="22" background="resources/images/tab/bg.gif"
										bgcolor="#FFFFFF"><div align="center">
											<span class="STYLE1">收支项目</span>
										</div></td>
									<td height="22" background="resources/images/tab/bg.gif"
										bgcolor="#FFFFFF"><div align="center">
											<span class="STYLE1">收支金额</span>
										</div></td>
									<td height="22" background="resources/images/tab/bg.gif"
										bgcolor="#FFFFFF"><div align="center">
											<span class="STYLE1">记账人</span>
										</div></td>
									<td height="22" background="resources/images/tab/bg.gif"
										bgcolor="#FFFFFF"><div align="center">
											<span class="STYLE1">摘要</span>
										</div></td>
									<td height="22" background="resources/images/tab/bg.gif"
										bgcolor="#FFFFFF" class="STYLE1"><div align="center">删除操作</div></td>
								</tr>
								<c:out value="${test}"></c:out>
								<c:forEach items="${viewList}" var="item">
								<tr id="delMark">
									<td height="20" bgcolor="#FFFFFF"><div align="center">
											<input type="checkbox" name="checkbox" value="${item.id}" />
										</div></td>
									<td height="20" bgcolor="#FFFFFF"><div align="center"
											class="STYLE1">
											<div align="center">${item.id}</div>
										</div></td>
									<td height="20" bgcolor="#FFFFFF"><div align="center">
											<span class="STYLE1">${item.createTime}</span>
										</div></td>
									<td height="20" bgcolor="#FFFFFF"><div align="center">
											<span class="STYLE1">${item.type}</span>
										</div></td>
									<td bgcolor="#FFFFFF"><div align="center">
											<span class="STYLE1">${item.item}</span>
										</div></td>
									<td height="20" bgcolor="#FFFFFF"><div align="center">
											<span class="STYLE1">${item.amount}</span>
										</div></td>
									<td height="20" bgcolor="#FFFFFF"><div align="center">
											<span class="STYLE1">${item.member}</span>
										</div></td>
									<td height="20" bgcolor="#FFFFFF"><div align="center">
											<span class="STYLE1">${item.summary}</span>
										</div></td>
									<td height="20" bgcolor="#FFFFFF"><div align="center">
											<span class="STYLE4">
											<img src="resources/images/tab/del.gif" width="16" height="16" />
											<a href="#del" name="${item.id }">删除</a>
											</span>
										</div></td>
								</tr>
								</c:forEach>
							</table></td>
						<td width="8" background="resources/images/tab/tab_15.gif">&nbsp;</td>
					</tr>
				</table></td>
		</tr>
		<tr>
			<td height="35" background="resources/images/tab/tab_19.gif"><table
					width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td width="12" height="35"><img
							src="resources/images/tab/tab_18.gif" width="12" height="35" /></td>
						<td><table width="100%" border="0" cellspacing="0"
								cellpadding="0">
								<tr>
									<td class="STYLE4">&nbsp;&nbsp;共有 ${pageInfo.totalRows } 条记录，当前第 ${pageInfo.pageNum }/${pageInfo.totalPages } 页</td>
									<td><table border="0" align="right" cellpadding="0"
											cellspacing="0">
											<tr>
												<td width="40"><a target="center-table" href="queryByType?pageNum=1&dateType=${dateType}&dateNum=${dateNum}" id="href1">
													<img src="resources/images/tab/first.gif" width="37" height="15" /></a></td>
												<td width="45"><a target="center-table" href="queryByType?pageNum=${pageInfo.pageNum-1 }&dateType=${dateType}&dateNum=${dateNum}" id="href2">
													<img src="resources/images/tab/back.gif" width="43" height="15" /></a></td>
												<td width="45"><a target="center-table" href="queryByType?pageNum=${pageInfo.pageNum+1 }&dateType=${dateType}&dateNum=${dateNum}" id="href3">
													<img src="resources/images/tab/next.gif" width="43" height="15" /></a></td>
												<td width="40"><a target="center-table" href="queryByType?pageNum=${pageInfo.totalPages}&dateType=${dateType}&dateNum=${dateNum}" id="href4">
													<img src="resources/images/tab/last.gif" width="37" height="15" /></a></td>
												<td width="100">
													<div align="center">
														<span class="STYLE1">转到第
															<input name="pageNum" type="text" size="4"
															style="height: 12px; width: 20px; border: 1px solid #999999;"/>页
														</span>
													</div>
												</td>
												<td width="40">
													<a href="javascript:void(0)" id="sub" name="&dateType=${dateType}&dateNum=${dateNum}"><img src="resources/images/tab/go.gif" width="37" height="15" /></a>
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table></td>
						<td width="16"><img src="resources/images/tab/tab_20.gif"
							width="16" height="35" /></td>
					</tr>
				</table></td>
		</tr>
	</table></div>
</body>
</html>